package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.ActivityListVO;
import com.digitalchina.lxnsy.toolkit.FrescoUtil;
import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2018/7/17 11:10
 * 修改备注：
 * ================================================
 */

public class ShopActivityHolder extends BaseViewHolder<ActivityListVO> {

    private SimpleDraweeView ivPicture;
    private TextView tvState;
    private TextView tvPrice;
    private TextView tvTitle;
    private TextView tvAddress;
    private TextView tvTime;

    private TextView tvManage;
    private TextView tvAmend;
    private TextView tvCancel;



    public ShopActivityHolder(ViewGroup parent) {
        super(parent, R.layout.item_shop_activity_list);
        ivPicture = $(R.id.iv_picture);
        tvState = $(R.id.tv_state);
        tvPrice = $(R.id.tv_price);
        tvTitle = $(R.id.tv_title);
        tvAddress = $(R.id.tv_address);
        tvTime = $(R.id.tv_time);

        tvManage = $(R.id.tv_manage);
        tvAmend = $(R.id.tv_amend);
        tvCancel = $(R.id.tv_cancel);

    }

    @Override
    public void setData(ActivityListVO data) {
        super.setData(data);

        FrescoUtil.showImageSmall(data.getImgPath(), ivPicture);
        tvState.setText(data.getActivityState() + "");
        tvTitle.setText(data.getActivityName() + "");
        tvTime.setText(data.getStartTime() + "");


        switch (data.getActivityState() + ""){
            case "即将开始":
                tvState.setBackgroundResource(R.color.activity_dengdai);
                break;
            case "正在进行":
                tvState.setBackgroundResource(R.color.activity_jinxing);
                break;
            case "已结束":
                tvState.setBackgroundResource(R.color.activity_jieshu);
                break;
        }

        if (data.getIsFee().equals("0")) {
            tvPrice.setText("免费");
        } else {
            tvPrice.setText("￥" + data.getFee());
        }
        tvAddress.setText(data.getAddress() + "");


    }

}
